package com.resou.reader.assist;

import com.google.gson.Gson;
import com.resou.reader.data.bookshelf.model.BookShelfBook;

import java.util.List;

/**
 * Created by ${Garrett} on 2018/11/27.
 * Contact me krouky@outlook.com
 */
public class test {

    /**
     * msg : SUCESS
     * code : 0
     * data : {"data":[{"readStatus":"未读","authorName":"月飘柔","whetherUpdate":3,"bookPic":"http://qidian.qpic.cn/qdbimg/349573/c_10000064403000003/180","bookName":"我的名字叫钢索","bookId":"10000064403000003yw"}]}
     */

    private String msg;
    private int code;
    private DataBeanX data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public DataBeanX getData() {
        return data;
    }

    public void setData(DataBeanX data) {
        this.data = data;
    }

    public static class DataBeanX {
        private List<BookShelfBook> data;

        public List<BookShelfBook> getData() {
            return data;
        }

        public void setData(List<BookShelfBook> data) {
            this.data = data;
        }

    }

    class Result<T> {
        private String msg;
        private int code;
        private List<T> data;

    }

    private static final String TAG = "test";
    public static void main(String[] args) {
        Gson gson = new Gson();
        String json = "{\n" +
                "  \"msg\" : \"SUCESS\",\n" +
                "  \"code\" : 0,\n" +
                "  \"data\" : {\n" +
                "    \"data\" : [ {\n" +
                "      \"readStatus\" : \"未读\",\n" +
                "      \"authorName\" : \"月飘柔\",\n" +
                "      \"whetherUpdate\" : 3,\n" +
                "      \"bookPic\" : \"http://qidian.qpic.cn/qdbimg/349573/c_10000064403000003/180\",\n" +
                "      \"bookName\" : \"我的名字叫钢索\",\n" +
                "      \"bookId\" : \"10000064403000003yw\"\n" +
                "    } ]\n" +
                "  }\n" +
                "}";
        test test = gson.fromJson(json, test.class);
        System.out.println( test.getData().getData().get(0).getBookName());
    }

}
